#include "menu_config.h"
#define CONFIG_DEMO

#define DEVICE_ID 	1001
#define VERSION_MAX	1
#define VERSION_MIN	12

struct config config;
struct config_uart cfg_uart =
{
	.baudrate = 9600,
	.databits = 8,
	.parity	=0,
	.stopbits = 1
};


struct config_protocol cfg_protocol =
{
    .type = 0,
    .pre_command = {0},
    .pre_timout = 0,
    .command = {0},
    .timeout = 0,
    .parser = 0,
	.endian = 0
};
struct config_output cfg_output =
{
    .begin_byte = 0,
    .length = 0,
    .end_byte = 0,
	.place = 0,
	.number = 0 
};

int config_reset(void)
{
// #ifdef CONFIG_DEMO
	config.device_id = DEVICE_ID;
	config.version_max = VERSION_MAX;
	config.version_min = VERSION_MIN;
	config.samp_interval_s = 1;
	config.uart = cfg_uart;
	config.protocol = cfg_protocol;
	config.output = cfg_output;
// #endif
return 0;
}

int config_check(void)
{
	return 0;
	
}

int config_get_cfg(void)
{

    // struct time_clock_time time;
    // time_clock_get_time(&time);
    // i2c_read_memory(&i2c_buf,0xa0,0x00,1,(uint8_t*)&config,sizeof(config));
    // while(i2c_get_state(&i2c_buf)!=0){
    //     if(time_clock_get_time_offset_ms(&time)>1000){
    //         return -1;
    //     }
    // }
    // if(config_check()==0){
    //     return 0;
    // }
    // config_reset();
    return 0;

}
